package play.`class`

open class People(val name: String) {
    open fun say(text: String) {
        println("$name say $text")
    }
}

class Child(name: String) : People(name) {
    override fun say(text: String) {
        print("child ")
        super.say(text)
    }
}


class Adult(name: String) : People(name) {
    override fun say(text: String) {
        print("adult ")
        super.say(text)
    }
}

fun main() {
    val c: People = Child("zing")
    c.say("hello")

    val a: People = Adult("old zing")
    a.say("hello")
}